#include <iostream>
#include <string>
#include <stack>

#include "buffermanager.hpp"

using namespace std;

int main()
{
    string ordre;
    int no, pag_fr;
    bufferManager buffman((char*)"prova");

    //cout << "ESTAT INICIAL" << endl;
    //for (int i = 0; i < 32; i++) buffman.stat(0, i);

    while(!cin.eof())
    {
        cin >> no >> ordre >> pag_fr;
        //cout << no << " " << ordre << " " << pag_fr << endl;
        if(ordre == string("query")) {
            cout << "EXECUTANT comanda " << no << ": 'query-" << pag_fr << "'" << endl;
            buffman.query(pag_fr);
        }
        else if(ordre == string("update"))
        {
            cout << "EXECUTANT comanda " << no << ": 'update-" << pag_fr << "'" << endl;
            buffman.update(pag_fr);
        }
        else if(ordre == string("unpin"))
        {
            cout << "EXECUTANT comanda " << no << ": 'unpin-" << pag_fr << "'" << endl;
            buffman.unpin(pag_fr);
        }
        else if(ordre == string("stat"))
        {
            cout << "EXECUTANT comanda " << no << ": 'stat-" << pag_fr << "'" << endl;
            buffman.stat(pag_fr);
        }
        //else if(ordre == string("pendent")) buffman.pendent();
        else cout<<"ERROR de sintaxi E/S"<<endl;
    }
}

